package com.jxstyle.modular.entity;

import java.util.ArrayList;
import java.util.List;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;

public class Menu extends Model<Menu> {

	private static final long serialVersionUID = 1L;
	private int id;// 主键
	private String code;// 编码
	private int pid;// 父级编码
	private String name;// 名称
	private String icon;// 图标
	private String url;// 访问路径
	private Integer sort;// 排序
	private Integer ismenu;// 是否为菜单 1：是，0：否
	private String tips;// 备注
	private Integer status;// 状态 1：正常，0：禁用

	@TableField(exist = false)
	private String pname;// 父级名称
	@TableField(exist = false)
	private String ismenuname;// 是否为菜单名称
	@TableField(exist = false)
	private List<Menu> childs;

	public List<Menu> getChilds() {
		return childs;
	}

	public void setChilds(List<Menu> childs) {
		this.childs = childs;
	}

	public void addChilds(Menu menu) {
		if (this.childs == null) {
			this.childs = new ArrayList<>();
		}
		this.childs.add(menu);
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public Integer getIsmenu() {
		return ismenu;
	}

	public void setIsmenu(Integer ismenu) {
		this.ismenu = ismenu;
	}

	public String getTip() {
		return tips;
	}

	public void setTips(String tips) {
		this.tips = tips;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getPname() {
		return pname;
	}

	public void setPname(String pname) {
		this.pname = pname;
	}

	public String getIsmenuname() {
		return this.ismenu != null && this.ismenu.intValue() == 1 ? "是" : "否";
	}

	public void setIsmenuname(String ismenuname) {
		this.ismenuname = ismenuname;
	}

	public String getTips() {
		return tips;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

}
